import java.util.*;

public class LearnArrays {
    public static void main(String args[]) {
        final LearnArrays myLearner = new LearnArrays();
        System.out.println("three by four:");
        myLearner.printNumberField(3, 4);
        System.out.println("\nzero by zero:");
        myLearner.printNumberField(0, 0);
        System.out.println("\nnine by ten:");
        myLearner.printNumberField(9, 10);
    }

    public void printNumberField(final int x, final int y) {
        for(final ArrayList<Integer> row : makeNumberField(x, y)) {
            for(final int number : row) {
                System.out.print(number + "\t");
            }
            System.out.println();
        }
    }

    public ArrayList<ArrayList<Integer>> makeNumberField(final int x, final int y) {
        final ArrayList<ArrayList<Integer>> numberField = new ArrayList<ArrayList<Integer>>();
        for (int i = 0; i < y; i++) {
            final ArrayList<Integer> row = new ArrayList<Integer>();
            numberField.add(row);
            for (int j = 0; j < x; j++) {
                row.add(j);
            }
        }
        return numberField;
    }
}
